from ckeditor_uploader.fields import RichTextUploadingField
from django.db import models


# Create your models here.

class RecommendTpye(models.Model):
    type = models.CharField(max_length=40, verbose_name='类型')

    def __str__(self):
        return self.type

    class Meta:
        verbose_name = '学习推荐网站类型'
        verbose_name_plural = '学习推荐网站类型'


class LearnRecommend(models.Model):
    name = models.CharField(max_length=100, verbose_name='名字')
    url = models.CharField(max_length=200, verbose_name='地址')
    abstract = models.TextField(max_length=200, verbose_name='摘要')
    local_img = models.ImageField(upload_to='upload/activity', max_length=100, null=True, blank=True, verbose_name='本地上传图片')
    online_img = models.CharField(max_length=100, null=True, blank=True, verbose_name='在线图片地址')
    type = models.ForeignKey(RecommendTpye, on_delete=models.CASCADE)

    def __str__(self):
        return self.name

    class Meta:
        verbose_name = '学习推荐网站'
        verbose_name_plural = '学习推荐网站'

